<!-- Google dfp -->


var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') + 
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();



googletag.cmd.push(function() {

googletag.defineSlot('/11364921/Novo_slider_1', [578, 466], 'div-gpt-ad-1337369837402-0').addService(googletag.pubads());

googletag.defineSlot('/11364921/Novo_slider_2', [578, 466], 'div-gpt-ad-1337370013832-0').addService(googletag.pubads());

googletag.defineSlot('/11364921/Novo_Slider_3', [578, 466], 'div-gpt-ad-1337370083656-0').addService(googletag.pubads());

googletag.defineSlot('/11364921/Novo_Slider_4', [578, 466], 'div-gpt-ad-1337370131099-0').addService(googletag.pubads());

googletag.defineSlot('/11364921/Novo_Slider_5', [578, 466], 'div-gpt-ad-1337370169014-0').addService(googletag.pubads());

googletag.defineSlot('/11364921/Nova_Lateral_1', [165, 225], 'div-gpt-ad-1337726756248-0').addService(googletag.pubads());

googletag.defineSlot('/11364921/Nova_Lateral_2', [165, 225], 'div-gpt-ad-1337727130645-0').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});


<!-- END Google dfp -->

try{
  if(typeof MOBILE != 'undefined' && MOBILE){ 
     const checkElement = async selector => {
      while ( document.querySelector(selector) === null) {
        await new Promise( resolve =>  requestAnimationFrame(resolve) )
      }
      return document.querySelector(selector); 
    };
    checkElement('.mobile-header').then((selector) => {
      var pageHead = document.head || document.getElementsByTagName('head')[0];
      var styleTag = document.createElement('style');
      var bannerTopoStyle = '.bannerTopo-mobile~.ui-panel-content-wrap>.ui-content.ui-content{margin-top: 150px;}.bannerTopo-mobile{position:fixed;left:0;top:0;height:40px;width:100%;max-width:640px;z-index:9999;}.bannerTopo-link{background-color:#ff0317;display:block;height:40px;width:100%;}.bannerTopo-image{width:100%;height:100%;object-fit:contain;}.mobile-header{top:40px!important;}';
    
      pageHead.appendChild(styleTag);
      styleTag.appendChild(document.createTextNode(bannerTopoStyle));
    
      var headerMobileRef = document.querySelector('.mobile-header.float-header');
      var bannerTopoHtml = '<div class="bannerTopo-mobile"><a href="/campanha-desconto-progressivo/?itm_cpg_name=esquentasemanadoconsumidor_allproducts&itm_cpg_position=banner_topo_campanha_principal" class="bannerTopo-link"><img src="https://staticmobly.akamaized.net/cms/marketing/campanha/2021/primaria/20210302/YGZm5/bannertopo-mobile.gif" class="bannerTopo-image" alt="Esquenta Semana do Consumidor"></a></div>';
    
      headerMobileRef.insertAdjacentHTML('beforebegin',bannerTopoHtml);
    });
    try{
      $.getScript("https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js")
      .done(function(script, textStatus) {
        try{
          var sliderMenuCategorias = $(".slider-menucategorias");
          sliderMenuCategorias.owlCarousel({
            loop: false,
            items: 2,
            margin:10,
            stagePadding:35,
            autoplay: true,
            dots: false,
            nav: false,
          });
          var sliderPerenes = $(".slider-perenes");
          sliderPerenes.owlCarousel({
            autoplay: true,
            autoplaySpeed: 500,
            fluidSpeed: true,
            loop: true,
            dots: true,
            nav: false,
            items: 1,
            stagePadding:30,
            margin:15,
            onInitialize: function (event) {
              $('.slider-perenes').show();
            }
          });
        }catch(e){}
      });
    }catch(e) {}
    /*Button texto legal click*/
    $('.btn-txt-legal').on("click", function() {
      $('.btn-txt-legal.--active').not(this).removeClass('--active');
      $(this).toggleClass('--active');
    });
  }else{
    function changeSeoTagLevelBlackFriday(){
      var ishome = location.pathname=='/';
      var seoTitleBlack = document.getElementById('seoTitleBlack');
      var sectionBlackFriday = document.getElementById('sectionBlackFriday');
      if(ishome){
        seoTitleBlack.remove();
        sectionBlackFriday.innerHTML='<h1 id="seoTitleBlack"><a href="/black-friday">Black Friday 2021 é Black Mobly | Móveis, Decoração e mais</a></h1>'
      }
    }
    (function(){
      changeSeoTagLevelBlackFriday();
    })();
    $.getScript("https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js")
    .done(function(script, textStatus) {
      try{
        var owl = $(".owl-carousel");
        //Slider Init
        owl.owlCarousel({
            autoplay: true,
            autoplaySpeed: 500,
            fluidSpeed: true,
            autoplayHoverPause: true,
            loop: true,
            dots: true,
            nav: true,
            items: 1,
            // lazyLoad: true,
            // lazyLoadEager: 2,
            onInitialize: function (event) {
                $('.owl-carousel').show();
            }
        });
        $(".main-carousel-desktop").mouseover(function() {
            $(".main-carousel-desktop .owl-nav").css("display", "block");
        });
        $(".main-carousel-desktop").mouseout(function() {
            $(".main-carousel-desktop .owl-nav").css("display", "none");
        });
        var sliderPerenes = $(".slider-perenes");
        sliderPerenes
        .owlCarousel(
          {
            autoplay: true,
            autoplaySpeed: 500,
            fluidSpeed: true,
            autoplayHoverPause: true,
            loop: true,
            dots: true,
            nav: true,
            items: 1,
            margin:15,
            onInitialize: function (event) {
                $('.slider-perenes').show();
            },
            responsive : {
              // breakpoint from 640 up
              640 : {
                  items : 3
              }
            }
          }
        );

      }catch(e){}
    });
  }
}catch(e){}
//change name selo black friday
$('.jetmobly-vue .itm-flag.itm-black-friday span').text('Mobly');

try{
  if(typeof MOBILE != 'undefined' && MOBILE){
    //Start - Countdown plugin Mobile
    !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(a){if(a instanceof Date)return a;if(String(a).match(g))return String(a).match(/^[0-9]*$/)&&(a=Number(a)),String(a).match(/\-/)&&(a=String(a).replace(/\-/g,"/")),new Date(a);throw new Error("Couldn't cast `"+a+"` to a date object.")}function c(a){var b=a.toString().replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");return new RegExp(b)}function d(a){return function(b){var d=b.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);if(d)for(var f=0,g=d.length;f<g;++f){var h=d[f].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/),j=c(h[0]),k=h[1]||"",l=h[3]||"",m=null;h=h[2],i.hasOwnProperty(h)&&(m=i[h],m=Number(a[m])),null!==m&&("!"===k&&(m=e(l,m)),""===k&&m<10&&(m="0"+m.toString()),b=b.replace(j,m.toString()))}return b=b.replace(/%%/,"%")}}function e(a,b){var c="s",d="";return a&&(a=a.replace(/(:|;|\s)/gi,"").split(/\,/),1===a.length?c=a[0]:(d=a[0],c=a[1])),Math.abs(b)>1?c:d}var f=[],g=[],h={precision:100,elapse:!1,defer:!1};g.push(/^[0-9]*$/.source),g.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source),g=new RegExp(g.join("|"));var i={Y:"years",m:"months",n:"daysToMonth",d:"daysToWeek",w:"weeks",W:"weeksToMonth",H:"hours",M:"minutes",S:"seconds",D:"totalDays",I:"totalHours",N:"totalMinutes",T:"totalSeconds"},j=function(b,c,d){this.el=b,this.$el=a(b),this.interval=null,this.offset={},this.options=a.extend({},h),this.instanceNumber=f.length,f.push(this),this.$el.data("countdown-instance",this.instanceNumber),d&&("function"==typeof d?(this.$el.on("update.countdown",d),this.$el.on("stoped.countdown",d),this.$el.on("finish.countdown",d)):this.options=a.extend({},h,d)),this.setFinalDate(c),this.options.defer===!1&&this.start()};a.extend(j.prototype,{start:function(){null!==this.interval&&clearInterval(this.interval);var a=this;this.update(),this.interval=setInterval(function(){a.update.call(a)},this.options.precision)},stop:function(){clearInterval(this.interval),this.interval=null,this.dispatchEvent("stoped")},toggle:function(){this.interval?this.stop():this.start()},pause:function(){this.stop()},resume:function(){this.start()},remove:function(){this.stop.call(this),f[this.instanceNumber]=null,delete this.$el.data().countdownInstance},setFinalDate:function(a){this.finalDate=b(a)},update:function(){if(0===this.$el.closest("html").length)return void this.remove();var b,c=void 0!==a._data(this.el,"events"),d=new Date;b=this.finalDate.getTime()-d.getTime(),b=Math.ceil(b/1e3),b=!this.options.elapse&&b<0?0:Math.abs(b),this.totalSecsLeft!==b&&c&&(this.totalSecsLeft=b,this.elapsed=d>=this.finalDate,this.offset={seconds:this.totalSecsLeft%60,minutes:Math.floor(this.totalSecsLeft/60)%60,hours:Math.floor(this.totalSecsLeft/60/60)%24,days:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToWeek:Math.floor(this.totalSecsLeft/60/60/24)%7,daysToMonth:Math.floor(this.totalSecsLeft/60/60/24%30.4368),weeks:Math.floor(this.totalSecsLeft/60/60/24/7),weeksToMonth:Math.floor(this.totalSecsLeft/60/60/24/7)%4,months:Math.floor(this.totalSecsLeft/60/60/24/30.4368),years:Math.abs(this.finalDate.getFullYear()-d.getFullYear()),totalDays:Math.floor(this.totalSecsLeft/60/60/24),totalHours:Math.floor(this.totalSecsLeft/60/60),totalMinutes:Math.floor(this.totalSecsLeft/60),totalSeconds:this.totalSecsLeft},this.options.elapse||0!==this.totalSecsLeft?this.dispatchEvent("update"):(this.stop(),this.dispatchEvent("finish")))},dispatchEvent:function(b){var c=a.Event(b+".countdown");c.finalDate=this.finalDate,c.elapsed=this.elapsed,c.offset=a.extend({},this.offset),c.strftime=d(this.offset),this.$el.trigger(c)}}),a.fn.countdown=function(){var b=Array.prototype.slice.call(arguments,0);return this.each(function(){var c=a(this).data("countdown-instance");if(void 0!==c){var d=f[c],e=b[0];j.prototype.hasOwnProperty(e)?d[e].apply(d,b.slice(1)):null===String(e).match(/^[$A-Z_][0-9A-Z_$]*$/i)?(d.setFinalDate.call(d,e),d.start()):a.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi,e))}else new j(this,b[0],b[1])})}});
        //End - Countdown plugin Mobile
  }else{}
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~ */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~ */
    /* Start - Setup do countdown */
    if( typeof $.fn.countdown != "undefined"){
          try{
          /*Cronometro dias e horas
          $('.bannercronometro-timer').countdown('2020/07/24 10:30:00', function(event) {
            var totalHours = event.offset.totalDays * 24 + event.offset.hours;
            var totalDays = (Math.floor(totalHours * 24) - 1);
            $(this).html(event.strftime("%D:%H:%M:%S"));
          });*/   
          /*Cronometro horas*/
          $('#ofertaDia').countdown('2021/03/05 10:30:00', function(event) {
              var totalHours = event.offset.totalDays * 24 + event.offset.hours;
              var totalDays = (Math.floor(totalHours / 24) - 1);
              $(this).html(event.strftime("%H:%M:%S"));
          });
          $('#primaria').countdown('2021/03/09 10:30:00', function(event) {
              var totalHours = event.offset.totalDays * 24 + event.offset.hours;
              var totalDays = (Math.floor(totalHours / 24) - 1);
              $(this).html(event.strftime("%H:%M:%S"));
          });
        }catch(e){}
         
    }
    /* End - Setup do countdown */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~ */
    /* ~~~~~~~~~~~~~~~~~~~~~~~~~~ */
}catch(e){}
// Universal Analytics

// Condição IF que executa o GA para Mobile
if (typeof MOBILE != 'undefined' && MOBILE) {
    (function(i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function() {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date();
        a = s.createElement(o),
            m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })

    // Executa script padrão para Analytics
    (window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    // Informa a conta do GA (tracking code)

    try{    
	       var user_id = getCookie('responsysId');
            }catch(e){
               var user_id=null;
            }

    if(user_id && user_id.length>0)
    {
    sanitized_user_id = user_id;
    }
    else
    {
    sanitized_user_id = undefined;
    }

    ga('create', 'UA-24883739-1', 'auto','mobly2Tracker', {'cookieDomain': 'mobly.com.br', 'userId': sanitized_user_id});
  //  ga('mobly2Tracker.require', 'GTM-TP2PXV6');

    // Envia evento para o GA
    ga('mobly2Tracker.require', 'linkid', 'linkid.js'); //liberar in-page analytics
    ga('mobly2Tracker.require', 'displayfeatures');
    console.log('ga mobile debug');
    ga('mobly2Tracker.send', 'pageview');

   
    
}

// #email hash#
try{
$("input[name='NewsletterSignupForm\[email\]'],#email,#NewsletterFormPopUp_email,#LoginForm_email,#RegistrationForm_email,#loginForm #username").blur(
	function(){
		try{
		var vl=$(this).val(); 
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(vl)){
			setCookie('responsysId',md5(vl), 63072000000, '.mobly.com.br');
		};}catch(e){console.log(e)}
	}
);
}
catch(e)
{
//ignore
}

// End Universal Analytics


try{
    $(document).ready(function() {
        // $('.banner-televendas').dialog({width:650, height:509});
        if (window.location.hash == "#mobly-televendas") {
            $(".modal-telesales-phones").trigger("click");
        }
        if (window.location.search == "?mobly-televendas") {
            $(".modal-telesales-phones").trigger("click");
        }
        if (window.location.toString().match(/mobly-televendas/)) {
                $(".modal-telesales-phones").trigger("click");
        }

    });
}catch(e){}

/* Grok Hover 
try{
    $("#grokstyle-modal").append('<div class="buscapimg-hover"><i class="arrow-up"></i> <p>Experimente nossa <br/>busca por imagem</p></div>');
}catch(e){}*/

try {

	// chrome
	if(/Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)) {

		function _getCallerFile() {

	        var err = new Error();
	        var callerfile;
	        var currentfile;

	        Error.prepareStackTrace = function (err, stack) { return stack; };
	        currentfile = err.stack.shift().getFileName();

	        while (err.stack.length) {
	            callerfile = err.stack.shift().getFileName();
	            if(currentfile !== callerfile) return callerfile;
	        }

		    return currentfile;
		}

		var __cookieDescriptor = Object.getOwnPropertyDescriptor(Document.prototype, 'cookie') ||
	                 Object.getOwnPropertyDescriptor(HTMLDocument.prototype, 'cookie');


	    var __startCookies = document.cookie;
	    var __changedCookies = [];
	    var __countCookies = document.cookie.split(';').length;

		if (__cookieDescriptor && __cookieDescriptor.configurable) {
		    Object.defineProperty(document, 'cookie', {
		        get: function () {
		            return __cookieDescriptor.get.call(document);
		        },
		        set: function (val) {

		        	try{
						var countB = document.cookie.split(';').length;
		        		__changedCookies.push({'value':val,'caller':_getCallerFile()});


		        	}catch(__ex__){
		        		var countB=0;
		        	}

		            __cookieDescriptor.set.call(document, val);


		            try {
			            __countCookies = document.cookie.split(';').length;

			            fire = false;

			            var data = moblyTracking.dataKinesis || {};

			            if( (countB - __countCookies) > 3 ) {

			            	fire = true;
			            	data.type = 'cookieEvictionEvent';
							console.log('cookie eviction detected...');
							console.log('Sending cookie eviction event ');
			            }

			            if(/mobsessid/.test(val)){

			            	fire = true;
			            	data.type = 'cookieSessidOverideEvent';
							console.log('cookie sessid overide detected...');
							console.log('Sending cookie sessid overide event ');
			            }



			            if(fire){
			            	
			            	data.countBefore = countB;
			            	data.countAfter = __countCookies;
			            	data.currentTry =  val;
			            	data.startCookies =  __startCookies;
			            	data.changedCookies =  JSON.stringify(__changedCookies);
                                        data.agent =  window.navigator.userAgent;
			            	data.uri =  window.location.pathname + window.location.search;

			            	data = JSON.stringify(data);
			            	console.log('Sending cookie event : ');
			            	console.log(data);

							var firehose = new AWS.Firehose({
							                    accessKeyId: AWS_KEY,
							                    secretAccessKey: AWS_SECRET,
							                    region: AWS_REGION
							                });

			                var params = {
							    DeliveryStreamName: 'mobly-tis-front-events',
							    Record: {
							        Data: data + '\n'
							    	}
								};

							firehose.putRecord(params, function(err, data) {
								if (err) {
								  console.log('error sending event');
								  console.log( err );
								} else {
								  console.log('Event successfully sent');
								}
				          	});                
					    }
			            
			        } catch(____ez_____){}
		       	}
		    });
		}
	}

}catch(_______e){ }


$(document).ready(function(){
  $('li.outletH, li.outletH *').on('mouseenter', function(){
    $('li.outletH').addClass('active');
    $('.menu-overlay').css('display', 'block');
  });


  $('li.lancamentosH, li.lancamentosH *').on('mouseenter', function(){
    $('li.lancamentosH').addClass('active');
    $('.menu-overlay').css('display', 'block');
  });


  $('.menu-main.content-limits > ul > li').on('mouseenter', function(){
      $('.menu-main.content-limits > ul > li').each(function(){
        $(this).removeClass('active');
      });
      $(this).addClass('active');
  })
   
   $('li.menuSubHover').on('mouseenter', function () {
         $('.menu-overlay').addClass('active');
   });
   $('li.menuSubHover').on('mouseleave', function () {
         $('.menu-overlay').removeClass('active');
   });
});
try {
    $(document).ready(function() {
        if ($(".dynamic_option_assembly_required").text() == "Sim, sugerimos a contratação do nosso serviço de montagem (para os CEPs em que o serviço está disponível) ou de algum profissional experiente de sua preferência") {
            $(".dynamic_option_assembly_required").html('Sim, sugerimos a contratação de um profissional ou do Serviço de Montagem Mobly (para os CEPs em que ele está disponível). <a href="javascript:void(0)" data-toggle="modal" data-target="#installationTermsModal" id="installationTerms">Saiba mais</a>.');
        }
    })
} catch(e) {}

var s = document.createElement("script");
s.type = "text/javascript";
s.src = "https://chatmobly.dbm.com.br/chat-dbm.js?v=2";
document.getElementsByTagName('head')[0].appendChild(s);
$('#customer-service-footer').click(function() {
    $('#modalCustomerService').modal({keyboard: true});
    
    $('#btn-customer-order').click(function() {
        if (auth.notLogged()) {
            $('#modalCustomerService').modal('hide');
        }     
    });
});